import { NGXLogger } from 'ngx-logger';
import { Component, OnInit } from '@angular/core';
import { EventService , EventSource} from '../services/event.service';
import { User, UserType } from '../entity/TT';
import { RequestReplyService } from '../services/request-reply.service';

@Component({
  selector: 'app-whiteboard',
  templateUrl: './whiteboard.component.html',
  styleUrls: ['./whiteboard.component.scss']
})
export class WhiteboardComponent implements OnInit {

  enable : boolean = true;
  enableController: boolean = false;

  constructor(
    private log: NGXLogger,
    private eventService: EventService,
    private requestService: RequestReplyService)
  {
    this.log.debug("WhiteboardComponent...")

    this.eventService.subscribeWhiteBoardChanged((act:boolean)=>{
      this.enable = act;
    })

    // this.eventService.subscribeLogin((u:User)=>{
    //   this.log.debug('subscribeLogin', u)
    //   this.enableController = u.userType == UserType.Teacher
    //   return true;
    // });



  }

  ngOnInit() {
    // this.log.debug("WhiteboardComponent ngOnInit...")
    // this.requestService.GetMe().subscribe((me)=>{
    //   this.enableController = me.userType == UserType.Teacher
    // })
  }

}
